package com.zte.claa.inficombo.csa.app.service.gprs.bean;

public class BytesArrayForCC {
    private int initlen;
    private byte[] bytes;
    private int currlen;
    
    public BytesArrayForCC(int initlen){
    	this.initlen = initlen;
    	this.bytes = new byte[initlen];
    	this.currlen = 0;
    }

    public void push(byte data){
    	this.bytes[currlen] = data;
    	this.currlen++;
    }
    
    public void push(byte[] dataarr){
    	if(null == dataarr || dataarr.length == 0){
    		return;
    	}
    	for(int i=0; i<dataarr.length; i++){
    		this.bytes[this.currlen+i] = dataarr[i];
    	}
    	this.currlen += dataarr.length;
    }
    
	public int getInitlen() {
		return initlen;
	}

	public void setInitlen(int initlen) {
		this.initlen = initlen;
	}

	public byte[] getBytes() {
		byte[] retbytes = new byte[this.currlen];
		for(int i=0; i<this.currlen; i++){
			retbytes[i] = this.bytes[i];
		}
		return retbytes;
	}
	
	public byte[] getReverseBytes() {
		byte[] reservebytes = new byte[this.currlen];
		for(int i=0; i<this.currlen; i++){
			reservebytes[i] = this.bytes[this.currlen-i-1];
		}
		return reservebytes;
	}

	public void setBytes(byte[] bytes) {
		this.bytes = bytes;
	}

	public int getCurrlen() {
		return currlen;
	}

	public void setCurrlen(int currlen) {
		this.currlen = currlen;
	}
    
    
}
